package com.kaifamiao.datatypes;

// 自动类型提升:
// 1、将数值范围较小的数据类型的值赋值给数值范围较大的数据类型的变量
//    byte => short => int => long => float => double
//            char
public class Monkey {
    public static void main(String[] args) {
        byte first = 127; // byte: 1字节(8bits)
        System.out.println( first );

        // 将一个 byte 值 赋值 给 short 变量
        short second = first; // short: 2字节(16bits)
        System.out.println( second );

        // 将一个 byte 值 赋值 给 int 变量
        // int third = first;
        // 将一个 short 值 赋值 给 int 变量
        int third = second;
        System.out.println( third );

        // long fourth = first; // byte => long
        // long fourth = second; // short => long
        long fourth = third; // int => long
        System.out.println( fourth );

        // float fifth = first; // byte => float
        // float fifth = second; // short => float
        // float fifth = third; // int => float
        float fifth = fourth; // long => float
        System.out.println( fifth );

        double sixth = fifth; // float => double
        System.out.println( sixth );

        // repeat 是 从 JDK 11 中 String 类新增的方法
        System.out.println( "- ".repeat( 15 ) );

        char ch = '\u55B5';
        System.out.println( ch );

        double d = ch;
        System.out.println( d );
    }
}
